import React, { useState } from 'react'
import style from './index.module.scss'

export default function ({url,onLoad}) {
    const [hasLoaded, setHasLoaded]= useState(false)
    const onLoad_= ()=>{
        setHasLoaded(true)
        onLoad && onLoad()
    }
    return (
        <div className={style.img_box}>
            <img className={[style.img,hasLoaded?"":style.hide].join(' ')} src={url} onLoad={onLoad_} />
        </div>
    )
}